#include "precompiled.hpp"
#include "parse.hpp"

int main(int argc, char **argv)
{
	if (argc<2)
	{
		std::cerr<<"Not enough arguments for JAMPREP!"<<std::endl;
		return 1;
	}

	try
	{
		parse_context parser(argv[1],false,true);
		parser.parse();
		const scan_context::comment_map_t &comments=parser.scanner_.get_comments();
		for(scan_context::comment_map_t::const_iterator f=comments.begin();
			f!=comments.end();++f)
		{
			const jam_string &str=f->second;
			size_t pos=str.find_first_not_of(" \t");
			if (pos!=jam_string::npos)
				std::cout<<str.substr(pos);
			std::cout<<std::endl;
		}
	}catch(const jam_exception &ex)
	{
		std::cerr<<ex.what()<<std::endl;
		return 1;
	}

	return 0;
}
